<?php

use yii\db\Migration;

class m000004_000003_create_package extends Migration
{
    public function safeUp()
    {
        $this->createTable('{{%package}}', [
            'id' => $this->primaryKey(),
            'name' => $this->string(32)->notNull()->comment('名称'),
            'data' => $this->decimal(20, 4)->notNull()->defaultValue(0)->comment('数据流量（B）'),
            'sms' => $this->integer()->notNull()->defaultValue(0)->comment('短信数量'),
            'voice' => $this->integer()->notNull()->defaultValue(0)->comment('语音（分钟）'),
            'price' => $this->decimal(20, 4)->notNull()->defaultValue(0)->comment('费用'),
            'extra_data' => $this->decimal(20, 4)->notNull()->defaultValue(1024)->comment('超出流量（B）'),
            'extra_data_price' => $this->decimal(20, 4)->notNull()->defaultValue(0)->comment('超出流量费用'),
            'extra_sms_price' => $this->decimal(20, 4)->notNull()->defaultValue(0)->comment('超出短信费用'),
            'extra_voice_price' => $this->decimal(20, 4)->notNull()->defaultValue(0)->comment('超出语音费用'),
            'create_time' => $this->integer()->notNull()->comment('创建时间'),
            'remark' => $this->text()->comment('备注'),
        ]);
    }

    public function down()
    {
        $this->dropTable('{{%package}}');
    }
}
